package com.wanghua.mall.product.webcontroller;

import com.wanghua.mall.product.frontvo.SkuItemVo;
import com.wanghua.mall.product.service.SkuInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.annotation.Resource;

/**
 * @author wanghua
 * @create 2021-09-01 11:55
 */
@Controller
public class ItemController {
    @Resource
    private SkuInfoService skuInfoService;

    //获取商品详情页
    @GetMapping("/{skuId}.html")
    public String item(@PathVariable("skuId") Long skuId, Model model) {
        SkuItemVo skuItemVo = skuInfoService.item(skuId);
        model.addAttribute("item", skuItemVo);
        return "item";
    }
}
